﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Windows;
using System.Windows.Media.Imaging;
using MockupDesigner.Editors;

namespace MockupDesigner.Items
{
    [ImageEditor]
    public class ImageItem : ResizableItem
    {

        // Using a DependencyProperty as the backing store for Text.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty SourceProperty =
            DependencyProperty.Register("Source", typeof(string), typeof(ImageItem), new UIPropertyMetadata(string.Empty));

        public string Source
        {
            get { return (string)GetValue(SourceProperty); }
            set
            {
                string val = value;
                if (string.IsNullOrEmpty(value))
                {
                    val = "/Resources/Images/NoImage.png";
                }
                if (this.Source == val && !string.IsNullOrEmpty(val)) return;
                OnPropertyChanging("Source", this.Source, val);
                SetValue(SourceProperty, val);
                OnPropertyChanged("Source");
            }
        }

    }
}
